﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Boggle
{
    public static class TwoDimensionalArrayExtensions
    {
        public static void ForEach<T>(this T[,] array, Action<T> action)
        {
            if (array == null)
            {
                throw new ArgumentNullException("array");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            for (int i = 0; i < array.GetLength(0); i++)
            {
                for (int j = 0; j < array.GetLength(1); j++)
                {
                    action(array[i, j]);
                }
            }
        }
    }
}
